package libofei.config.interceptor;

import libofei.interceptor.AdminInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterConfig implements WebMvcConfigurer {

    @Autowired
    private AdminInterceptor adminInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //后台拦截
        registry.addInterceptor(adminInterceptor).addPathPatterns(
                "/admin*",
                "/admin/**/*"
        ).excludePathPatterns(
                "/admin/sys/login",
                "/admin/**/*.js",
                "/admin/**/*.html",
                "/admin/**/*.css",
                "/admin/**/*.woff",
                "/admin/**/*.jpg",
                "/admin/**/*.png"
        );

    }
}
